]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
st/texture-cache: Set up sliced images to fill parent
authorFlorian Müllner <fmuellner@gnome.org>
Fri, 9 Jun 2023 17:52:15 +0000 (19:52 +0200)
committerMarge Bot <marge-bot@gnome.org>
Wed, 5 Jul 2023 10:36:14 +0000 (10:36 +0000)
When using fractional scaling, the size of the loaded image with
applied scaling may still differ from the displayed size. This
is currently addressed by syncing the size of all slice actors
in the (probably only) caller.

Instead, set the actors to fill their parent automatically.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2798>

src/st/st-texture-cache.c

index bbe31bda7c1028db7574b85e3d42e0e77471ae36..7037c07d1511b34880549cac837a7e5e99c980b0 100644 (file)
@@ -1321,6 +1321,12 @@ on_sliced_image_loaded (GObject *source_object,
   if (g_task_had_error (task) || g_cancellable_is_cancelled (data->cancellable))
     return;
 
+  clutter_actor_set_layout_manager (data->actor,
+                                    g_object_new (CLUTTER_TYPE_BIN_LAYOUT, NULL));
+  /* stop propagation of child expand flags */
+  clutter_actor_set_x_expand (data->actor, FALSE);
+  clutter_actor_set_y_expand (data->actor, FALSE);
+
   pixbufs = g_task_propagate_pointer (task, NULL);
 
   for (list = pixbufs; list; list = list->next)
@@ -1328,6 +1334,10 @@ on_sliced_image_loaded (GObject *source_object,
       ClutterActor *actor = load_from_pixbuf (GDK_PIXBUF (list->data),
                                               data->paint_scale,
                                               data->resource_scale);
+      clutter_actor_set_x_expand (actor, TRUE);
+      clutter_actor_set_y_expand (actor, TRUE);
+      clutter_actor_set_x_align (actor, CLUTTER_ACTOR_ALIGN_FILL);
+      clutter_actor_set_y_align (actor, CLUTTER_ACTOR_ALIGN_FILL);
       clutter_actor_hide (actor);
       clutter_actor_add_child (data->actor, actor);
     }